package cn.stronglink.assetmanage.index.base;

import android.support.annotation.Nullable;

import java.lang.ref.WeakReference;

/**
 * @author zww
 * 2018 2018/6/8 2:27
 */
public abstract class BasePresenter<V> {
    @Nullable
    protected WeakReference<V> mViewRef;

    public void attachView(V view) {
        this.mViewRef = new WeakReference<>(view);
    }

    protected V getView() {
        return mViewRef.get();
    }
    public void detachView () {
        if (mViewRef != null) {
            mViewRef.clear();
            mViewRef = null;
        }
    }
    public abstract void onStart();
    public abstract void onStop();
    public abstract void start ();
}